1. Field of the Invention
The present invention relates to a compile apparatus that compiles a source program and generates an object program, and particularly to a compile apparatus and a compiler which compile a source program, which generates a number of specific mask instructions when compiled, to generate an object program whose execution efficiency is improved and whose size is small.
2. Description of the Related Art
By generating an object program which uses as much data space as is available in a register, a compiler can enhance the execution efficiency of that object program and also can reduce the code size.
However, in the actual compile environment, there are cases where the data width prescribed by a programming language is shorter than the width of a hardware register. In the case where a source program written in such a programming language uses a variable of the short data type, it is necessary that a compiler sets operations invalidating the excess bits from the data width on the register, in the object program. In such case, a conventional compiler makes the excess bits from the data width on the register all zero, by generating bit conjunction instructions (hereinafter referred to as a mask instruction), where a value (hereinafter referred to as a mask value), in which specific bits are all unity is used and where bits other than specific bits of a value (which becomes an object of arithmetic operation) are made all zero.
Incidentally, it is easily predictable that a number of mask values and mask instructions appear in the generated object program, depending upon hardware which runs the object program and the language of the source program.
In the aforementioned conventional compiler, however, when a source program generating a number of mask values and mask instructions, as described above, is compiled, there is the need to set an instruction to set a mask value to a register every time a mask value appears. Therefore, in a function whose entire size is small, there is the problem that setting and executing this instruction is turned into overhead time to be reckoned with, and consequently, the problem that there are cases where the execution efficiency of the object program is reduced.